package com.cskaoyan.gateway.util;

import com.mall.commons.result.AbstractResponse;
import com.mall.commons.result.GoodsResponseData;
import com.mall.commons.result.GoodsResponseUtil;
import com.mall.shopping.constants.ShoppingRetCode;
import com.mall.shopping.dto.GoodsResponse;

/**
 * @description: TODO
 * @author: jiaolei
 * @date: 2021/12/13 9:43
 */
public class ShoppingGoodsUtil {
    public static <T> GoodsResponseData getGoodsResponseData(AbstractResponse response, T t) {
        if(!ShoppingRetCode.SUCCESS.getCode().equals(response.getCode())){
            return new GoodsResponseUtil<>().setErrorMsg(response.getMsg(),System.currentTimeMillis());
        }

        return new GoodsResponseUtil<>().setData(t,System.currentTimeMillis());
    }
}
